<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
// [js] 请写出一个函数求出N的阶乘（即N!）
function factorial(n) {
      if (n > 1)  return n*factorial(n-1);
      return 1;
}
factorial(10)
console.log(factorial(10));

const stepNum = (num) => (num === 1 ? num : num * stepNum(num - 1));

console.log(stepNum(3))
console.log(stepNum(4))
console.log(stepNum(5))
console.log(stepNum(10))
</script>
</html>